Add APA102 and DEFAULT_I2C_BUS definitions to the lilygo_tdongle_s3#10773
Merged
dhalbert merged 1 commit intoadafruit:10.0.xfrom Jan 6, 2026
Merged
Add APA102 and DEFAULT_I2C_BUS definitions to the lilygo_tdongle_s3#10773dhalbert merged 1 commit intoadafruit:10.0.xfrom
dhalbert merged 1 commit intoadafruit:10.0.xfrom
Conversation
Author
|
This PR was tested
import time
import adafruit_vl6180x
import board
import busio
# print(dir(board))
# T-Dongle display
display = board.DISPLAY
# disables the repl on the display for our own use
# display.root_group = None
# Fails on T-Dongle with -> NotImplementedError: No default I2C bus
# This code succeeds with PR https://github.com/adafruit/circuitpython/pull/10773
i2c = board.STEMMA_I2C()
# i2c = busio.I2C(board.STEMMA_SCL, board.STEMMA_SDA)
# manually grab a lock before scanning brought in by ai copilot
while not i2c.try_lock():
time.sleep(0.5)
# 2. (Optional but recommended) Scan for devices to get addresses
print("Scanning for I2C devices...")
# Get the addresses found on the STEMMA bus
addresses = [hex(addr) for addr in i2c.scan()]
print(f"I2C addresses found on STEMMA bus: {addresses}")
i2c.unlock()
# We don't need to manage locking when using adafruit_bus_device.I2CDevice
print("VL6180X opening device...")
sensor = adafruit_vl6180x.VL6180X(i2c, offset=0)
print("VL6180X found {}".format(sensor))
# You can add an offset to distance measurements here (e.g. calibration)
# Swapping for the following would add a +10 millimeter offset to measurements:
# sensor = adafruit_vl6180x.VL6180X(i2c, offset=10)
# Main loop prints the range and lux every second:
while True:
# Read the range in millimeters and print it.
range_mm = sensor.range
print(f"Range: {range_mm}mm")
# Read the light, note this requires specifying a gain value:
# - adafruit_vl6180x.ALS_GAIN_1 = 1x
# - adafruit_vl6180x.ALS_GAIN_1_25 = 1.25x
# - adafruit_vl6180x.ALS_GAIN_1_67 = 1.67x
# - adafruit_vl6180x.ALS_GAIN_2_5 = 2.5x
# - adafruit_vl6180x.ALS_GAIN_5 = 5x
# - adafruit_vl6180x.ALS_GAIN_10 = 10x
# - adafruit_vl6180x.ALS_GAIN_20 = 20x
# - adafruit_vl6180x.ALS_GAIN_40 = 40x
light_lux = sensor.read_lux(adafruit_vl6180x.ALS_GAIN_1)
print(f"Light (1x gain): {light_lux}lux")
# Delay for a second.
time.sleep(1.0)boot_out.txt
|
dhalbert
approved these changes
Jan 6, 2026
Collaborator
dhalbert
left a comment
There was a problem hiding this comment.
This looks fine. Thanks very much for fixing the board definition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change for the LILYGO T-Dongle-S3 pen drive board https://lilygo.cc/en-us/products/t-dongle-s3
board.STEMMA_I2Cand theAPA102status lights.